package com.ruoyi.consumer.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consumer.mapper.CCarouselMapper;
import com.ruoyi.consumer.domain.CCarousel;
import com.ruoyi.consumer.service.ICCarouselService;

/**
 * 轮播图Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-23
 */
@Service
public class CCarouselServiceImpl implements ICCarouselService 
{
    @Autowired
    private CCarouselMapper cCarouselMapper;

    /**
     * 查询轮播图
     * 
     * @param carouselId 轮播图主键
     * @return 轮播图
     */
    @Override
    public CCarousel selectCCarouselByCarouselId(Integer carouselId)
    {
        return cCarouselMapper.selectCCarouselByCarouselId(carouselId);
    }

    /**
     * 查询轮播图列表
     * 
     * @param cCarousel 轮播图
     * @return 轮播图
     */
    @Override
    public List<CCarousel> selectCCarouselList(CCarousel cCarousel)
    {
        return cCarouselMapper.selectCCarouselList(cCarousel);
    }

    /**
     * 新增轮播图
     * 
     * @param cCarousel 轮播图
     * @return 结果
     */
    @Override
    public int insertCCarousel(CCarousel cCarousel)
    {
        cCarousel.setCreateTime(DateUtils.getNowDate());
        return cCarouselMapper.insertCCarousel(cCarousel);
    }

    /**
     * 修改轮播图
     * 
     * @param cCarousel 轮播图
     * @return 结果
     */
    @Override
    public int updateCCarousel(CCarousel cCarousel)
    {
        cCarousel.setUpdateTime(DateUtils.getNowDate());
        return cCarouselMapper.updateCCarousel(cCarousel);
    }

    /**
     * 批量删除轮播图
     * 
     * @param carouselIds 需要删除的轮播图主键
     * @return 结果
     */
    @Override
    public int deleteCCarouselByCarouselIds(Integer[] carouselIds)
    {
        return cCarouselMapper.deleteCCarouselByCarouselIds(carouselIds);
    }

    /**
     * 删除轮播图信息
     * 
     * @param carouselId 轮播图主键
     * @return 结果
     */
    @Override
    public int deleteCCarouselByCarouselId(Integer carouselId)
    {
        return cCarouselMapper.deleteCCarouselByCarouselId(carouselId);
    }
}
